﻿package fwk.panelInfos {	

	import flash.display.MovieClip;
	import fwk.interfaces.IPanelDisplayer;
	
	public class PanelDisplayer extends MovieClip implements IPanelDisplayer{
		
		private var _mc:MovieClip;
		public var container:MovieClip;
		
		public function get mc():MovieClip
		{
			return _mc;
		}
		public function set Main(val:MovieClip)
		{
			container = val;
		}
		//-----------------------------------------------------------------------
		function PanelDisplayer(_mc:MovieClip = null){
			if(_mc != null) this._mc = _mc;
			else this._mc = this;
		}
		//----------------------------------------------------------
		public function display(){
			_mc.x = container.stage.stageWidth/2 - _mc.clip.width/2;
			_mc.y = container.stage.stageHeight/2 - _mc.clip.height/2;
			
			container.stage.addChild(_mc);
			_mc.gotoAndPlay("display");

		}

		//----------------------------------------------------------
		public function close(){
			trace("close error panel");
			container.stage.removeChild(_mc);
		}
	}
}
